package com.bluedot.www.core.pojo.BO;

import javax.mail.internet.MimeBodyPart;
import java.util.List;

/**
 * @author He Peng
 * @version 1.0
 * @date 2021/9/2 12:31
 */
public class MailBo {
    /**
     * 发送邮箱
     */
    private String sendTo;

    /**
     * 邮件主题
     */
    private String subject;

    /**
     * 邮件内容：可以加入html内容
     */
    private String content;

    /**
     * 图片内容，如果获取本地图片使用此方法，如果是在线图片再content中内嵌即可
     */
    private List<MimeBodyPart> image;

    /**
     * 附件
     */
    private List<MimeBodyPart> attachment;

    /**
     * 标题
     */
    private String title;

    /**
     * 用户
     */
    private String username;

    /**
     * 审核结果
     */
    private String result;

    /**
     * 备注
     */
    private String note;

    /**
     * 验证码
     */
    private String code;


    public MailBo(String sendTo, String subject, String content, String title, String code) {
        this.sendTo = sendTo;
        this.subject = subject;
        this.content = content.replace("${title}", title)
                .replace("${username}", sendTo)
                .replace("${code}", code);
        this.title = title;
        this.code = code;
    }


    public MailBo(String sendTo, String subject, String content, String title, String result, String note) {
        this.sendTo = sendTo;
        this.subject = subject;
        this.content = content.replace("${title}", title)
                .replace("${username}", sendTo)
                .replace("${result}", result)
                .replace("${note}", note);
        this.title = title;
        this.result = result;
        this.note = note;
    }


    public MailBo() {
    }

    public MailBo(String sendTo, String subject, String content) {
        this.sendTo = sendTo;
        this.subject = subject;
        this.content = content;
    }

    public MailBo(String sendTo, String subject, String content, List<MimeBodyPart> image, List<MimeBodyPart> attachment) {
        this.sendTo = sendTo;
        this.subject = subject;
        this.content = content;
        this.image = image;
        this.attachment = attachment;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.content = content.replace("${title}", title);
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.content = content.replace("${username}", sendTo);
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.content = content.replace("${result}", result);
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.content = content.replace("${note}", note);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.content = content.replace("${code}", code);
    }

    public String getSendTo() {
        return sendTo;
    }

    public void setSendTo(String sendTo) {
        this.sendTo = sendTo;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public List<MimeBodyPart> getImage() {
        return image;
    }

    public void setImage(List<MimeBodyPart> image) {
        this.image = image;
    }

    public List<MimeBodyPart> getAttachment() {
        return attachment;
    }

    public void setAttachment(List<MimeBodyPart> attachment) {
        this.attachment = attachment;
    }


}
